package com.woniu.controller;

import com.nimbusds.jose.JOSEException;
import com.woniu.entity.HospitalUser;
import com.woniu.service.UserService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/login")
    public ResponseUtil login(@RequestBody HospitalUser hospitalUser) throws JOSEException {
        return userService.login(hospitalUser);
    }
    @PostMapping("/register")
    public ResponseUtil register(@RequestBody HospitalUser hospitalUser){
        return userService.register(hospitalUser);
    }

}
